<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>   
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
	String contextPath = request.getContextPath();
%>

<script src = "http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script>
	$(document).ready(function(){
		var num = 0;
		var fileindex = $('#fileview tr').children().length;
		$('#addFile').click(function(){
			$('#filev').append(
							'<tr width="350px"><td>'+
							'<input type="file" title="파일첨부 1 :  용량 1,048,576 바이트 이하만 업로드 가능" class="frm_file frm_input" name="upload['+ num +']"/>'+
							'<input type="button" data-num="'+ num +'" class="delete_button" value="삭제">' +
							'</td></tr>'
								);
			
			num = num + 1;
		});
		
	});
	
</script>
 <form:form enctype="multipart/form-data" commandName="command">
   <hr>

<!-- Wrapper -->
<div id="wrapper">         
<!-- Contenter_Sub -->
<div id="container_sub">

<!-- Content_List -->
<div id="sub_page_bg4"></div><!-- Sub Page Background -->      
<div id="content_list">
<div class="title">
<div class='sub_title'>
	<ul>
	<li>데이트코스</li>
<li class='stitle'>이만하면 나도 연애 고수!!</li>
</ul>
</div>

<div class='navig'>
<ul>
<li class='frst'><img src='../image/all/home_icon.png' align='absmiddle' width='13' height='13'><a href='<%=contextPath %>/main/index.do'>HOME</a></li>
<li>회원서비스</li>
<li>데이트코스</li>
</ul></div>

<!-- sub_menu-->
<ul class='sub_menu'>		
	  <ul class="sub_tab">
		
		<li><a class='rollover' href="<%=contextPath%>/propose/write.do">프로포즈</a></li>
		<li><a class='rollover' href="<%=contextPath%>/propose/search.do">이상형찾기</a></li>
		<li><a class='rollover' href="<%=contextPath %>/recommend/allList.do">회원현황</a></li>
		<li><a class='rollover' href="<%=contextPath %>/eventBoard/list.do">파티&미팅</a></li>
		<li><a class='over' href="<%=contextPath %>/dcourseBoard/list.do">데이트코스</a></li>  </ul>
	 </ul>	
		

</div>

<!-- skin : /home/wedaehan/www/skin/board/basic2 --><style>
ul,ol,li {list-style:none;}
li {display:inline;}
</style>
<section id="bo_w">
<h2 id="container_title">1:1 문의하기 글쓰기</h2>


<form:errors element="div"/>
<div class="tbl_frm01 tbl_wrap">
<table>
  <tbody>
     <tr>
      <th scope="row"><label for="writer_name">이름</label></th>
      <td>
       
      <form:input path="writer_name" size="20" maxlegth="20" id="writer"/> 
      <form:errors path="writer_name"/>
      </td>
     </tr>
     
     <tr>
      <th scope="row"><label for="password">패스워드</label></th>
      <td>
     <form:password size="20" maxlength="20" path="password"/>
      <form:errors path="password"/>
      </td>
     </tr>
     
     <tr>
       <th scope="row"><label for="title">제목</label></th>
       <td>
        <div id="autosave_wrapper">
        <form:input  id="wr_subject"  size="50" maxlength="255" path="title"/>
        <form:errors path="title"/>                     
       </td>
     </tr>
     <tr>
       <th scope="row"><label for="content">내용</label></th>
       <td class="wr_content">
         <form:textarea id="content" path="content"/><br>
            <form:errors path="content" class="ckeditor" maxlength="65536"/>
       </td>
     </tr>
     </table>
     <table>
     <tr id="fileview">
       <th scope="row">파일 #1</th>
        <td width="100px">
          <input type="button" id="addFile" value="첨부파일추가">
        </td>
        <td id="filev">
        		
        </td>
     </tr>
  </table>
</div>
<input type="hidden" name="id" value="${id}">
 <div class="btn_confirm">
        <input type="submit" value="작성완료" id="btn_submit" class="btn_submit" >
        <a href="list.do" class="btn_cancel">취소</a>
 </div>

    <script>
        function html_auto_br(obj)
    {
        if (obj.checked) {
            result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을<br>태그로 변환하는 기능입니다.");
            if (result)
                obj.value = "html2";
            else
                obj.value = "html1";
        }
        else
            obj.value = "";
    }

    function fwrite_submit(f)
    {
        var wr_content_editor_data = CKEDITOR.instances.wr_content.getData();
if (!wr_content_editor_data) { alert("내용을 입력해 주십시오."); CKEDITOR.instances.wr_content.focus(); return false; }
if (typeof(f.wr_content)!="undefined") f.wr_content.value = wr_content_editor_data;

        var subject = "";
        var content = "";
        $.ajax({
            url: g5_bbs_url+"/ajax.filter.php",
            type: "POST",
            data: {
                "subject": f.wr_subject.value,
                "content": f.wr_content.value
            },
            dataType: "json",
            async: false,
            cache: false,
            success: function(data, textStatus) {
                subject = data.subject;
                content = data.content;
            }
        });

        if (subject) {
            alert("제목에 금지단어('"+subject+"')가 포함되어있습니다");
            f.wr_subject.focus();
            return false;
        }

        if (content) {
            alert("내용에 금지단어('"+content+"')가 포함되어있습니다");
            if (typeof(ed_wr_content) != "undefined")
                ed_wr_content.returnFalse();
            else
                f.wr_content.focus();
            return false;
        }

        if (document.getElementById("char_count")) {
            if (char_min > 0 || char_max > 0) {
                var cnt = parseInt(check_byte("wr_content", "char_count"));
                if (char_min > 0 && char_min > cnt) {
                    alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다.");
                    return false;
                }
                else if (char_max > 0 && char_max < cnt) {
                    alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다.");
                    return false;
                }
            }
        }

        
        document.getElementById("btn_submit").disabled = "disabled";

        return true;
    }
    </script>
</section>
<!-- } 게시물 작성/수정 끝 -->      
      <div id="blank">&nbsp;</div>
      </div>
      <!-- //content_list -->

   </div>
   <!-- //contenter_sub -->

</div>
<!-- //wrapper -->

<script>
$(document).ready(function(){
  $(window).scroll(function () {
   if ($(this).scrollTop() > 10) { 
        $('#back-top').fadeIn();
   } else {
       $('#back-top').fadeOut();
   }
  });

  $('#back-top').click(function () {
   $('body,html').animate({
        scrollTop: 0
   }, 200);
        return false;
  });
});
</script>
<style>
#back-top {
 position: fixed;
 bottom: 100px; /* 부라우저 밑에서 위로 떨어질 높이설정  */
 left: 90%;
 margin:0px;  /* 부라우저 중앙에서 우측으로 떨어질 거리설정  */
 z-index:999;
 display:none;
}
</style>
<div id="back-top">
    <a href="#wrap"><img src="../image/all/go_top.png" width="60" height="60" alt="위로가기"></a>
</div>
</form:form>